<div class="box-header">
	<h3>CẬP NHẬT THÔNG TIN KHÁCH HÀNG</h3>
</div>
<?php 
	if(!empty($this->arrCart)):
		$yourCart = new Zend_Session_Namespace('cart');
		$carInfo = $yourCart->getIterator();
	
		$config = new Zendvn_Controller_Config(array('module'=>'admin',
												'fileConfig'=>'product-category.ini'));
		$itemConfig = $config->getconfig('item');
		
		$tblItem = new Zendvn_Model_Table_Product();
		
		
		$name 		= $this->formText('name', $this->Item['name']);
		$email 		= $this->formText('email', $this->Item['email']);
		$phone 		= $this->formText('phone', $this->Item['phone']);
		$address 	= $this->formText('address', $this->Item['address']);
		
		$comment	= !empty($this->Item['comment'])?$this->Item['comment']:$carInfo['comment'];
		$comment 	= $this->formTextarea('comment', $comment);
	
?>
<form id="check-out" name="check-out" method="post">
	<div class="customer_info">
		<div class="head_label">THÔNG TIN NGƯỜI MUA</div>
		<div class="dev">
			<label>Họ và tên :</label>
			<?php 
				echo $name;
				if(!empty($this->errors['name'])):
					echo '<span class="errors">' . $this->errors['name'] . '</span>';
				endif;
			?>
		</div>
		<div class="dev">
			<label>Địa Chỉ :</label>
			<?php 
				echo $address;
				if(!empty($this->errors['address'])):
					echo '<span class="errors">' . $this->errors['address'] . '</span>';
				endif;
			?>
		</div>
		<div class="dev">
			<label>Số Điện Thoại Liên Hệ :</label> 
			<?php 
				echo $phone;
				if(!empty($this->errors['phone'])):
					echo '<span class="errors">' . $this->errors['phone'] . '</span>';
				endif;
			?>
		</div>
		<div class="dev">
			<label>Email :</label>
			<?php 
				echo $email;
				if(!empty($this->errors['email'])):
					echo '<span class="errors">' . $this->errors['email'] . '</span>';
				endif;
			?>
			
		</div>
		<div class="dev">
			<label>Ghi chú về đơn hàng :</label>
			<?php 
				echo $comment;
				if(!empty($this->errors['comment'])):
					echo '<span class="errors">' . $this->errors['comment'] . '</span>';
				endif;
			?>
		</div>
	</div>
	
	
	<div class="my_cart checkout">
		<div class="lev header">
			<div class="name">Tên sản phẩm</div>
			<div class="price">Giá bán (1 SP)</div>
			<div class="quantity">Số lượng đặt mua</div>
			<div class="total_price">Thành tiền</div>
		</div>
		<?php 
			$totalPrice = 0;
			foreach ($this->arrCart as $k => $v):
				$productInfo 	= $tblItem->getItem(array('id' => $v['id']));
				
				$name			= Zendvn_Filter_Filter::filterContent($productInfo['name'], 'filter');
				$size			= $this->slbSize[$v['size']];
				$size			= Zendvn_Filter_Filter::filterContent($size, 'filter');
				$color			= $this->slbColor[$v['color']];
				$color			= Zendvn_Filter_Filter::filterContent($color, 'filter');
				$price			= $v['price'];
				$quantity		= $v['quantity'];
				
				$pricePerItem	= $price * $quantity;
				$totalPrice		= $totalPrice + $pricePerItem;
			
		?>
		<div class="lev item">
			<div class="name">
				<p><?php echo $name?></p>
				<p class="size">Size: <?php echo $size?></p>
				<p class="color">Color: <?php echo $color?></p>
			</div>
			<div class="price"><?php echo number_format($price)?>(VNĐ)</div>
			<div class="quantity">
				<span class="number"><?php echo $quantity?></span>
			</div>
			<div class="total_price"><?php echo number_format($pricePerItem)?>(VNĐ)</div>
		</div>
		<?php endforeach;?>
	
		<div class="footer">
			<div class="cart_left">Tổng cộng</div>
			<div class="cart_right"><?php echo number_format($totalPrice)?></div>
		</div>
		<div class="footer">
			<div class="cart_left">Khuyến mãi</div>
			<div class="cart_right">0</div>
		</div>
		<div class="footer">
			<div class="cart_left">Tính tổng</div>
			<div class="cart_right"><?php echo number_format($totalPrice)?></div>
		</div>
	
	</div>
	<div class="cart_button">
		<a href="#"><span>Thực hiện thanh toán</span></a>
	</div>
</form>
<?php endif;?>



<script>
	$(document).ready(function(){
		$('.cart_button a').click(function(){
			$('form#check-out').submit();
			return false;
		})
	})
</script>